#include <iostream>
#include <vector>
#include <string>

using namespace std;

void solve() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    vector<string> results;

    while (T--) {
        int N;
        string S;
        cin >> N >> S;

        if (N == 1) {
            results.push_back(S);
            continue;
        }

        int pos = -1;
        for (int i = 0; i < N - 1; ++i) {
            if (S[i] > S[i + 1]) {
                pos = i;
                break;
            }
        }

        if (pos == -1) {
            pos = N - 1;
        }

        string result = S.substr(0, pos) + S.substr(pos + 1) + S[pos];
        results.push_back(result);
    }

    for (const auto& res : results) {
        cout << res << '\n';
    }
}

int main() {
    solve();
    return 0;
}